//--------------------------------------------------------------------------------
// This file is a portion of the D2D1Renderer.  It is distributed
// under the MIT License, available in the root of this distribution and 
// at the following URL:
//
// http://www.opensource.org/licenses/mit-license.php
//
// Copyright (c) Mirco Timmermann
//
// Sources: http://www.w3.org/TR/2dcontext/
//--------------------------------------------------------------------------------
#pragma once

#include <d2d1.h>
#include <string>


class CanvasRenderingContext2D {

///////////////////////////////////////////////////////////////////////////////////////////////
//                                     DRAW INTERFACE                                        //
///////////////////////////////////////////////////////////////////////////////////////////////

public:
	
	CanvasRenderingContext2D::CanvasRenderingContext2D() {
		globalAlpha = 1.0; // (default 1.0)
        globalCompositeOperation = ""; // (default source-over)

		strokeStyle = "#000000"; // (default black)
        fillStyle = "#000000"; // (default black)

		shadowOffsetX = 0.0; // (default 0)
        shadowOffsetY = 0.0;; // (default 0)
        shadowBlur = 0.0;; // (default 0)
        shadowColor = "#000000"; // (default transparent black)
	}

	// state
	virtual void save() = 0; // push state on state stack
	virtual void restore() = 0; // pop state stack and restore state

	// compositing
           double globalAlpha; // (default 1.0)
           std::string globalCompositeOperation; // (default source-over)

	// colors and styles (see also the CanvasLineStyles interface)
           std::string strokeStyle; // (default black)
           std::string fillStyle; // (default black)

	//CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
	//CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
	//CanvasPattern createPattern((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, DOMString repetition);

	// shadows
           double shadowOffsetX; // (default 0)
           double shadowOffsetY; // (default 0)
           double shadowBlur; // (default 0)
           std::string shadowColor; // (default transparent black)

	// rects
	virtual void clearRect(double x, double y, double w, double h) = 0;
	virtual void fillRect(double x, double y, double w, double h) = 0;
	virtual void strokeRect(double x, double y, double w, double h) = 0;

	// current default path API (see also CanvasPathMethods)
	virtual void beginPath() = 0;
	virtual void fill() = 0;
	virtual void stroke() = 0;
	//void drawSystemFocusRing(Element element);
	//bool drawCustomFocusRing(Element element);
	//void scrollPathIntoView();
	virtual void clip() = 0;
	//bool isPointInPath(double x, double y);

	// text (see also the CanvasText interface)
	virtual void fillText(std::string text, double x, double y, double maxWidth = 0) = 0;
	virtual void strokeText(std::string text, double x, double y, double maxWidth = 0) = 0;
	//TextMetrics measureText(std::string text);

	// drawing images
	//void drawImage(Image image, double dx, double dy);
	//void drawImage(Image image, double dx, double dy, double dw, double dh);
	//void drawImage(Image image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);

	// pixel manipulation
	//ImageData createImageData(double sw, double sh);
	//ImageData createImageData(ImageData imagedata);
	//ImageData getImageData(double sx, double sy, double sw, double sh);
	//void putImageData(ImageData imagedata, double dx, double dy);
	//void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight);















	/*
	//variablen
	int font;
	int lineWidth;
	int strokeStyle;
	int fillStyle;
	float globalAlpha;
	float globalCompositeOperation;

	//methoden
	void fill();
	void fillText(int x, int y, ...);

	//Transforms
	void setTransform();
	*/

//private:


};







/*
	ID2D1StrokeStyle* _strokeStyle;
	ID2D1LinearGradientBrush* _pLinearGradientBrush;
	ID2D1PathGeometry* _pathGeometry;

	IDWriteFactory* dWriteFactory;
	IDWriteTextFormat* _textFormat;
	IDWriteTextLayout* _textLayout;
	*/